package com.veo.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class GatwayConfig {
    @Bean
    public RouteLocator routeLocator(RouteLocatorBuilder routeLocatorBuilder){
        RouteLocatorBuilder.Builder routes = routeLocatorBuilder.routes();
        //传入id,映射的路径，和服务的路径（但是路径写死了）
        routes.route("path_route_baidu",
                r -> r.path("/guonei").uri("http://news.baidu.com/gunnei")).build();
        return routes.build();
    }
}
